﻿
using System;
using NUnit.Framework;
using SharedResources.Model;
using SharedResources.Utilities;
using log4net.Config;

namespace HomesteadTests
{
    [TestFixture]
    public class TestUnderlyingData
    {
        private log4net.ILog _log = log4net.LogManager.GetLogger(
  System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        [TestFixtureSetUp]
        public void Init()
        {
            XmlConfigurator.Configure();
        }


        //[Test]
        //public void RequestUninitialisedOCTOST()
        //{
        //  try
        //  {
        //      UnderlyingData.RequestOCTOST();
        //  }
        //  catch (InvalidOperationException e)
        //  {
        //        _log.Info(e.Message);
        //  }
        //  Assert.Throws<InvalidOperationException>(() => UnderlyingData.RequestOCTOST());
        //}

        //[Test]
        //public void RequestIntialisedOCTOST()
        //{
        //    var sortedGroupedDataset = new SortedGroupedDataset();
        //    var rand = new Random();
        //    for (int i = 0; i < 10; i++)
        //    {
        //        var pointToAdd = new SpatioTemporalPoint(rand.Next(), DateTime.UtcNow, rand.NextDouble(),
        //                                                 rand.NextDouble());
        //        sortedGroupedDataset.Add(pointToAdd);
        //        _log.Info("Adding to dataset: " + pointToAdd.SpatialData);
        //    }
        //    UnderlyingData.SetOnceOCTOST(sortedGroupedDataset);
        //    var OCTOST = UnderlyingData.RequestOCTOST();
        //    Assert.AreEqual(10, OCTOST.GroupedTrajectorySets.Count);
        //}

        //[Test]
        //public void SetOnceOnlyOCTOST()
        //{
        //    UnderlyingData.SetOnceOCTOST(new SortedGroupedDataset()); //set it once
        //    try
        //    {
        //        UnderlyingData.SetOnceOCTOST(new SortedGroupedDataset()); //try set it again
        //    }
        //    catch(InvalidOperationException e)
        //    {
        //        _log.Info(e.Message);
        //    }
        //    Assert.Throws<InvalidOperationException>(() => UnderlyingData.SetOnceOCTOST(new SortedGroupedDataset()));
        //}

        //[Test]
        //public void ResetOCTOST()
        //{
        //    UnderlyingData.SetOnceOCTOST(new SortedGroupedDataset()); //set it once
        //    UnderlyingData.ResetUnderlyingData();
        //    UnderlyingData.SetOnceOCTOST(new SortedGroupedDataset()); //set it again
        //    var OCTOST = UnderlyingData.RequestOCTOST();
        //    Assert.AreNotEqual(null, OCTOST);
        //}
    }
}
